﻿
#region Using Directives

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    using MarketPulse.BusinessLogic.Common;

#endregion

namespace MarketPulse.BusinessLogic.Private.StateMachine
{
    internal class VisitStateFactory
    {
        public static IVisitState Create(Guid visitStatusTypeGuid, bool throwIfInvalid)
        {
            if (visitStatusTypeGuid.CompareTo(VisitStatusTypeList.Assigned) == 0)
            {
                return new VisitStateAssigned(throwIfInvalid);
            }
            else if (visitStatusTypeGuid.CompareTo(VisitStatusTypeList.AwaitingQA) == 0)
            {
                return new VisitStateAwaitingQA(throwIfInvalid);
            }
            else if (visitStatusTypeGuid.CompareTo(VisitStatusTypeList.Completed) == 0)
            {
                return new VisitStateCompleted(throwIfInvalid);
            }
            else if (visitStatusTypeGuid.CompareTo(VisitStatusTypeList.Created) == 0)
            {
                return new VisitStateCreated(throwIfInvalid);
            }
            else if (visitStatusTypeGuid.CompareTo(VisitStatusTypeList.DataEntryInProgress) == 0)
            {
                return new VisitStateDataEntryInProgress(throwIfInvalid);
            }
            else if (visitStatusTypeGuid.CompareTo(VisitStatusTypeList.QAInProgress) == 0)
            {
                return new VisitStateQAInProgress(throwIfInvalid);
            }
            else if (visitStatusTypeGuid.CompareTo(VisitStatusTypeList.QAApproved) == 0)
            {
                return new VisitStateQAApproved(throwIfInvalid);
            }
            else if (visitStatusTypeGuid.CompareTo(VisitStatusTypeList.QAFailed) == 0)
            {
                return new VisitStateQAFailed(throwIfInvalid);
            }
            else if (visitStatusTypeGuid.CompareTo(VisitStatusTypeList.QAOnHold) == 0)
            {
                return new VisitStateQAOnHold(throwIfInvalid);
            }
            else if (visitStatusTypeGuid.CompareTo(VisitStatusTypeList.Released) == 0)
            {
                return new VisitStateReleased(throwIfInvalid);
            }
            else if (visitStatusTypeGuid.CompareTo(VisitStatusTypeList.Transferred) == 0)
            {
                return new VisitStateTransferred(throwIfInvalid);
            }
            else if (visitStatusTypeGuid.CompareTo(VisitStatusTypeList.ReadyForTransfer) == 0)
            {
                return new VisitStateReadyForTransfer(throwIfInvalid);
            }

            throw new VisitStateUnrecognisedStateException();

        }
    }
}
